<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>${config.siteName!} - 扫码获取微信号</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.9">
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <link rel="stylesheet" type="text/css" href="/static/css/index.css">
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" charset="utf-8" src="/static/js/jquery-1.11.3.min.js"></script>
    <script src="/static/js/bootstrap.min.js"></script>
    <link  href="/static/layer/mobile/need/layer.css" rel="stylesheet">
    <script type="text/javascript" src="/static/layer/layer.js"></script>
    <script src="https://open.mobile.qq.com/sdk/qqapi.js?_bid=152"></script>
    <script src="/static/js/qq.js"></script>
</head>
<body>
<div style="height: 20px;"></div>
<center>
    <div  id="qrcode" title="${url!}"></div>
    <div style="height: 20px;"></div>
    <span style="font-size: 14px;color: #0c7cb5;">请使用微信扫码绑定用户</span>
</center>
<script src="/static/js/qrcode.min.js"></script>
<script src="/static/js/qcloud_util.js"></script>
<script>

    var state = '${state_bind!}';

    var qrcode = new QRCode("qrcode", {
        text: "${url!}",
        width: 200,
        height: 200,
        colorDark: "#000000",
        colorLight: "#ffffff",
        correctLevel: QRCode.CorrectLevel.H
    });

    window.onload = loadmsg();
    // 检查是否支付完成

    function loadmsg() {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/admin/ta/bind_status",
            timeout: 8000,
            data: {"state": state, "times": new Date().getDate()}, //post数据
            success: function (data, textStatus) {
                if (data.code == 1) {
                    layer.msg('绑定成功，正在跳转中...', {icon: 16, shade: 0.01, time: 15000});
                    window.location.href = data.backurl;
                } else {
                    setTimeout("loadmsg()", 1500);
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                if (textStatus == "timeout") {
                    setTimeout("loadmsg()", 1500);
                } else { //异常
                    setTimeout("loadmsg()", 3000);
                }
            }
        });
    }
</script>
</body>
</html>